<div>
    <?php
//    function getSpaceCategoryDisplayName($category) {
//             
//                    $categoryName = $category->getName();
//                    switch ($categoryName)
//                    {
//                        case BSpaceGroup::Group_Category_General:
//                          $categoryName = Yii::t('site',BSpaceGroup::Group_Category_General);
//                          break;
//                        case BSpaceGroup::Group_Category_Business:
//                          $categoryName = Yii::t('site',BSpaceGroup::Group_Category_Business);
//                          break;
//                        case BSpaceGroup::Group_Category_Public:
//                          $categoryName = Yii::t('site',BSpaceGroup::Group_Category_Public);
//                          break;
//                        case BSpaceGroup::Group_Category_NoneProfit:
//                          $categoryName = Yii::t('site',BSpaceGroup::Group_Category_NoneProfit);
//                          break;
//                        default:
//                          $categoryName = Yii::t('site',BSpaceGroup::Group_Category_General);
//                    }
//                   return $categoryName;        
//    }
    //$model = Blyn::app()->getActiveApp()->getFormModel('CreateSpaceFormModel');
    if (!isset($model))
        $model = new CreateSpaceFormModel('CreateSpace');
    $screen = Blyn::app()->getUIManager()->getCurrentScreen();
    $activeSpace = Blyn::app()->getActiveSpace();

    $completeStr = Yii::t('site', 'Complete');
    $nextStr = Yii::t('site', 'Next');
    $resetStr = Yii::t('site', 'Reset');
    $cancelStr = Yii::t('site', 'Cancel');
    $mySpaceIdStr = Yii::t('site', 'Space ID:');
    $spaceNameStr = Yii::t('site', 'Space Name:');
    $spaceCategoryStr = Yii::t('site', 'Space Category:');
    $spaceRoleStr = Yii::t('site', 'Space Role:');
    ?>
    <div class="well-small text-error">
        <?php
        //$checkError = Blyn::app()->getActiveSpace()->getContextVariable('checkError');
        if (isset($checkError) && $checkError != NULL) {

            echo $checkError;
        }
        ?>
    </div>
    <?php echo CHtml::beginForm(); ?>

    <fieldset>
        <div class="well" >
            <label><?php echo Yii::t('site', 'Add Space ID'); ?>:</label>
            <?php
            $mySpaceIdStr = Yii::t('site', 'Type ID');
            echo CHtml::activeTextField($model, 'mySpaceId', array('placeholder' => $mySpaceIdStr . '...',
                'class' => 'span4', 'required' => true, 'style' => 'min-height:30px'));
            ?>     
            <label> <?php echo Yii::t('site', 'Add Space Name'); ?>:</label>
            <?php
            $typeNameStr = Yii::t('site', 'Type name');
            echo CHtml::activeTextField($model, 'spaceName', array('placeholder' => $typeNameStr . '...',
                'class' => 'span4', 'required' => true, 'style' => 'min-height:30px'));
            ?>                
            <label> <?php echo Yii::t('site', 'Specify Space Category'); ?> :</label>                
            <?php
            echo CHtml::activeDropDownList($model, 'spaceCategory', BSpaceGroup::getSpaceCategoryList(), array('class' => 'span4', 'placeholder' => 'default category is business')
            );
            ?>
        </div>
    </fieldset>

    <div>
        <?php
//        $completeStr = Yii::t('site','Complete');
        $completeBtn = $screen->getAjaxLink($completeStr, array('htmlOptions' => array('class' => 'btn')));
        echo $completeBtn;
        ?>
        <?php
//        $nextStr = Yii::t('site','Next');
        //$nextBtn = $screen->createLink('nextBtn', array('linkType' => BUIScreen::LinkType_AjaxSubmitButton, 'label' => 'Next'));
        $nextBtn = $screen->getAjaxLink($nextStr, array('htmlOptions' => array('class' => 'btn')));
        echo $nextBtn;
        ?>
        <?php
//        $resetStr = Yii::t('site','Reset');
        echo CHtml::resetButton($resetStr, array('class' => 'btn'));
        ?>
        <?php
//         $cancelStr = Yii::t('site','Cancel');
        //$cancelBtn = $screen->createLink('cancelBtn', array('linkType' => BUIScreen::LinkType_AjaxSubmitButton, 'label' => 'Cancel'));
        $cancelBtn = $screen->getAjaxLink($cancelStr, array('htmlOptions' => array('class' => 'btn')));
        echo $cancelBtn;
        ?>
    </div>
    <?php echo CHtml::endForm(); ?>
</div>

